package main

import . "local/algorithm/util"

func mergeTwoLinkedList(l1, l2 *ListNode) *ListNode {
	if l1 == nil {
		return l2
	}

	if l2 == nil {
		return l1
	}
	if l1.Val < l2.Val {
		l1.Next = mergeTwoLinkedList(l1.Next, l2)
		return l1
	} else {
		l2.Next = mergeTwoLinkedList(l1, l2.Next)
		return l2
	}
}
